---
title: "Market Indicators"
author: "Charlotte McClintock"
output:
flexdashboard::flex_dashboard:
orientation: rows
social: menu
source_code: embed
---
```{r setup, include=FALSE}
library(knitr)
library(tidyverse)
library(shiny)
library(plotly)
library(DT)
library(shinythemes)
library(markdown)
library(rsconnect)
library(ggplot2)
load("stockmkt.Rdata")
```
```{r, eval=FALSE, echo=FALSE}
About {.sidebar}
-----------------------------------------------------------------------
This project explores indicators of the financial health and stability of the stock market including price to earnings ratio, price to sales ratio, US market capitalization to GDP, and volatility index.
```
Row {.tabset}
-----------------------------------------------------------------------
### S&P 500
```{r}
p <- ggplot(SP, aes(x=date, y=sp500)) +
geom_point(size = 1, color='darkblue') + geom_line(color='darkblue')
ggplotly(p)
```
### Willshire 5000 Total Market Full Cap Index
```{r}
p <- ggplot(wil, aes(x=date, y=wilshire5000)) +
geom_point(size = 1, color='darkgreen') + geom_line(color='darkgreen')
ggplotly(p)
```
### Dow Jones Industrial Average
```{r}
p <- ggplot(djia, aes(x=date, y=dowjones)) +
geom_point(size = 1, color='red') + geom_line(color='red')
ggplotly(p)
```
### NASDAQ Composite
```{r}
p <- ggplot(nasdaq, aes(x=date, y=nasdaq)) +
geom_point(size = 1, color='darkorange') + geom_line(color='darkorange')
ggplotly(p)
```
### All Markets
```{r}
p <- ggplot(mkts, aes(x=date, y=value, colour=market)) +
geom_point(size = 1) + geom_line()
ggplotly(p)
```
Row {.tabset}
-----------------------------------------------------------------------
### Price to Earnings Ratio - S&P 500
```{r}
p <- ggplot(PER, aes(x=date, y=price2earnings)) +
geom_point(size = 1, color='darkred') + geom_line(color='darkred')
ggplotly(p)
```
### Price to Sales Ratio - S&P 500
```{r}
p <- ggplot(PSR, aes(x=date, y=price2sales)) +
geom_point(size = 1, color='green') + geom_line(color='green')
ggplotly(p)
```
### Dividend Yield - S&P 500
```{r}
p <- ggplot(DY, aes(x=date, y=dividendyield)) +
geom_point(size = 1, color='blue') + geom_line(color='blue')
ggplotly(p)
```
### Market Cap to GDP - US
```{r}
p <- ggplot(data = mktcap2gdp, aes(x = date, y = mktcap2gdp)) +
geom_point(size = 1, color='orange') + geom_line(color='orange')
ggplotly(p)
```
### Volatility Index (VIX)
```{r}
p <- ggplot(data = vix, aes(x = date, y = volatilityindex)) +
geom_point(size = 1, color='purple') + geom_line(color='purple')
ggplotly(p)
```